home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 5
/
Amiga Plus Sonderheft 1996 #5.iso
/
programme
/
imagedesk304
/
imagedesk
/
instdata.lha
/
instdata
/
CatDescription
< prev
next >
Wrap
Text File
|
1995-07-10
|
5KB
|
156 lines
Description of ImageDesk catalog files
I decided to use C-syntax for the description as this might be the most
common programing language on the amiga.
The catalog header
~~~~~~~~~~~~~~~~~~
#define OLDCATIDENT 0x49444354
#define CATIDENT 0x49444341
struct CatHeader
{
ULONG Ident; /* as defined above */
ULONG FileSize; /* Raw Bytes of contained data, uncompressed,
without CatHeader */
UWORD NumEntries; /* Number of containing thumbnail entries */
UBYTE ThumbSize; /* max. values for width & height:
60, 80, 100, 120, 150 or 0! (see below) */
UBYTE UseXpk; /* 1 = Use XPK, 0 = Not Packed */
UBYTE Path[256]; /* Path where to find original images
of following entries */
};
If CatHeader.Ident has the value OLDCATIDENT, you have detected an old
catalog file. In this case CatHeader.ThumbSize is set to zero which
means the thumbnail images have the maximum size of 80x80 pixels
A catalog reader should do the following at first:
------------------------------------------------------------------------
...
if( sizeof(CatHeader) != Read(file,&CatHeader,sizeof(CatHeader)) )
{
puts("error reading file!");
...
}
else
{
switch(CatHeader.Ident)
{
case CATIDENT: break;
case OLDCATIDENT: CatHeader.ThumbSize = 80; break;
default: puts("Not an ImageDesk catalog file!") ...
}
...
}
...
------------------------------------------------------------------------
The thumbnail entries
~~~~~~~~~~~~~~~~~~~~~
struct ThumbEntry
{
UWORD SkipBytes; /* Skipt these number of bytes
to jump to next entry */
UBYTE FileName[108]; /* Filename of original image */
UWORD Width; /* Width of original image */
UWORD Height; /* Height of original image */
UWORD Depth; /* Bit depth of original image */
UWORD Type; /* Image Type (see below) */
UWORD Mode; /* Private!! */
UBYTE IconWidth; /* Real thumbnail width */
UBYTE IconHeight; /* Real thumbnail height */
BOOL Clut; /* is palette information available? */
};
Supported image types:
#define IT_IFF 0x0100
#define IT_GIF 0x0200
#define IT_JPG 0x0300
#define IT_PCX 0x0400
#define IT_BMP 0x0500
#define IT_PCD 0x0600
#define IT_PNM 0x0700
#define IT_TGA 0x0800
The lower 8 bit are reserved for future use. This means
you should avoid simple comparison for type checking:
WRONG:
if(Type == IT_IFF) puts("Image type is IFF");
RIGHT:
if((Type & 0xFF00) == IT_IFF) puts("Image type is IFF");
Right after the descriptor "struct ThumbEntry" the data of the
thumbnail image is stored. It contains the RGB values COLUMN BY
COLUMN starting with the top-left corner. One byte is used for
every pixel:
bit 7 6 5 4 3 2 1 0
---------------------------
R2 R1 R0 G2 G1 G0 B1 B0
|______| |______| |___|
Red Green Blue
Exactly (ThumbEntry.IconWidth * ThumbEntry.IconHeight) RasterBytes
are stored. THIS IS NOT THE SAME AS CatHead.ThumbSize!
Complete catalog file
~~~~~~~~~~~~~~~~~~~~~
-----------------------------
CatHeader (struct CatHeader)
----------------------------- -----|
|
Entry 1 (struct ThumbEntry) |
|
RasterData 1 |
|
----------------------------- |
|
Entry 2 (struct ThumbEntry) | If XPK has been used this
| body part is compressed
RasterData 2 | (CatHead.UseXpk == TRUE)
|
----------------------------- |
|
... |
|
----------------------------- |
|
Entry n (struct ThumbEntry) |
|
RasterData n |
|
----------------------------- -----|
If you have further questions on this document feel free to contact me
-- Reinhard Haslbeck